﻿@inherits AdminCompontentBase
@page "/webHook"
<PageTitle>@T("WebHook")</PageTitle>
<AutoHeight Overflow="!_showEmptyPlaceholder" AutoClass="mt-6">
    <HeaderContent>
        <SSearchPanel @bind-Value="@_queryParam.Filter" OnEnter="RefreshAsync" OnClearClick="HandleClearAsync" OnClick="()=> _upsertModal?.OpenModalAsync()!">
            <ChildContent>
                <DefaultPageTitle>@T("WebHook")</DefaultPageTitle>
            </ChildContent>
        </SSearchPanel>
    </HeaderContent>
    <AutoHeightContent>
        @if (!_showEmptyPlaceholder)
        {
            <MRow NoGutters Style="height:0;">
                @foreach (var _entitie in _entities.Result)
                {
                    <MCol Md="3" Class="pr-4 pb-4">
                        <WebHookCard WebHook="_entitie" OnEdit="()=> _upsertModal?.OpenModalAsync(_entitie)!" OnTest="()=> _testModal?.OpenModalAsync(_entitie.Id)!" />
                    </MCol>
                }
            </MRow>
        }
        else
        {
            <SEmptyPlaceholder />
        }
    </AutoHeightContent>
    <FooterContent>
        @if (!_showEmptyPlaceholder)
        {
            <SPagination Class="mt-6 rounded-2 pa-0" Page="@_queryParam.Page" PageSize="@_queryParam.PageSize" Total="_entities.Total" PageChanged="HandlePageChanged" PageSizeChanged="HandlePageSizeChanged" />
        }
    </FooterContent>
</AutoHeight>

<WebHookUpsertModal @ref="_upsertModal" OnOk="HandleOk" />
<WebHookTestModal @ref="_testModal" OnOk="HandleOk" />